$(document).ready(function() {
    $("#tabs").tabs({
        ajaxOptions: { async: true },

        cookie: { expires: 30},

        /*        refresh: function() {
         var self = this;
         var index = self.option("selected");
         self.load(index);
         },*/

        load: function(event, ui) {
            $(ui.panel).delegate('a', 'click', function(event) {
                if (this.id == "selectLink") {
                    var data = this.getAttribute("data-name") + "=" + document.getElementById("job_name_select").value;
                    $(ui.panel).load(this.href + "?" + data);
                } else if (this.id == "pauseLink" || this.id == "resumeLink") {


                    var data = this.getAttribute("data-name") + "=" + document.getElementById("job_name_select").value;
                    $.getJSON(this.href, data, function(result) {
                        if (result.status != 1) {
                            alert(result.msg);
                        }
                        $(ui.panel).load("montrigger/view_mon_trigger.htm?job_name_select=" + document.getElementById("job_name_select").value);
                    });


                    $(ui.panel).load(this.href + "?" + data);
                } else if (this.id == "searchLink") {
                    var data = this.getAttribute("data-name") + "=" + document.getElementById("trigger-search").value;
                    $(ui.panel).load(this.href + "?" + data);
                } else {
                    $(ui.panel).load(this.href);
                }

                event.preventDefault();
            });

            /*            $(ui.panel).delegate('select', 'change', function(event) {
             $(ui.panel).load(this.href);
             event.preventDefault();
             });

             $(ui.panel).delegate('form', 'submit', function(event) {
             $(ui.panel).load(this);
             event.preventDefault();
             });*/
        }
    });
    $("table").tablesorter({
        // sort on the first column and third column, order asc
        sortList: [
            [0,0]
        ]
    });
});